import Phaser from "phaser";

export default class Test extends Phaser.Scene {
    constructor() {
        super("Test");
    }

    preload() {
        // 加载组件包
        this.qGame.loadQPackage("Test", "/assets/QGame_测试.qgp");
    }

    create() {
        console.log("Test scene created");
        // 查看资源包列表
        console.log(this.qGame.getPackageInfo());
        // // 实例化一个view视图
        const view = this.qGame.add.createView("Test_测试");
        if (view) {
            console.log(view.convertToXML());
            const view2 = view.findViewByID("view_2");
            if (view2) {
                view2.onClick = () => {
                    alert("click");
                };
            }
        }
    }
}
